Communications 101

I will say "Hello World" in bold print just below this line by means of a JavaScript program.

Discussion

In this first program, you see how to include JavaScript directives in your HTML. This three-line script writes a bold "Hello World" followed by a paragraph break. Notice that JavaScript talks in HTML to your browser. Your write statements create HTML code which your browser must interpret.
<SCRIPT LANGUAGE="JavaScript">
document.write("<b>Hello World!</b><p>")
</SCRIPT>
In this example, as with all the scripts included on the JavaScript CD Cookbook, make sure to look at the source code that produced this page. Look for the aqua sections of the source code (click on "view source" from the chapter's table of contents)-- these are the ingredients that make these examples work. The sources will give you lots of ideas and templates to modify for your needs.
Copyright ©1998 by Charles River Media, All Rights Reserved